from django.contrib import admin

# Register your models here.

from .models import Student,StudentDetail

# 自定义设置
class StudentAdmin(admin.ModelAdmin):
    list_display = ['id', 'name', 'sex', 'age', 'qq', 'phone', 'c_time']
    list_display_links = ['id', 'name']
    list_filter = ['sex', 'age']
    search_fields = ['name', 'qq', 'phone']
    list_per_page = 2

    # fields = ['name', 'sex']
    fieldsets = (
        ('基本信息', {'fields': ['name', 'sex', 'age']}),
        ('详细信息', {'fields': ['qq', 'phone', 'grade']}),
        ('设置', {'fields': ['is_delete']}),
    )
admin.site.register(Student, StudentAdmin)
admin.site.register(StudentDetail)